﻿using Drill.Extensibility;
using NUnit.Framework;

namespace Drill.Configuration
{
	[TestFixture]
	public class ConfigSourceConfigurationTests
	{
		[Test]
		public void CanConstruct()
		{
			// Arrange
			// Nothing to arrange.

			// Act
			var itemUnderTest = new ConfigSourceConfiguration();

			// Assert
			Assert.That(itemUnderTest, Is.Not.Null);
		}

		[Test]
		public void EnabledPropertyIsFalseAfterDefaultConstruction()
		{
			// Arrange
			// Nothing to arrange.

			// Act
			var itemUnderTest = new ConfigSourceConfiguration();

			// Assert
			Assert.That(itemUnderTest.Enabled, Is.False);
		}

		[Test]
		public void KeyPropertyIsNullAfterDefaultConstruction()
		{
			// Arrange
			// Nothing to arrange.

			// Act
			var itemUnderTest = new ConfigSourceConfiguration();

			// Assert
			Assert.That(itemUnderTest.Key, Is.Null);
		}

		[Test]
		public void MethodPropertyIsDefaultAfterDefaultConstruction()
		{
			// Arrange
			const DrillBitConfigMethod expectedValue = DrillBitConfigMethod.Default;

			// Act
			var itemUnderTest = new ConfigSourceConfiguration();

			// Assert
			Assert.That(itemUnderTest.Method, Is.EqualTo(expectedValue));
		}

		[Test]
		public void ValuePropertyIsNullAfterDefaultConstruction()
		{
			// Arrange
			// Nothing to arrange.

			// Act
			var itemUnderTest = new ConfigSourceConfiguration();

			// Assert
			Assert.That(itemUnderTest.Value, Is.Null);
		}

		[Test]
		public void CanSetEnabledPropertyToFalse()
		{
			// Arrange
			var itemUnderTest = new ConfigSourceConfiguration();

			// Act
			itemUnderTest.Enabled = false;

			// Assert
			Assert.That(itemUnderTest.Enabled, Is.False);
		}

		[Test]
		public void CanSetEnabledPropertyToTrue()
		{
			// Arrange
			var itemUnderTest = new ConfigSourceConfiguration();

			// Act
			itemUnderTest.Enabled = true;

			// Assert
			Assert.That(itemUnderTest.Enabled, Is.True);
		}

		[Test]
		public void CanSetKeyProperty()
		{
			// Arrange
			const string expectedValue = @"MyConfigSource";
			var itemUnderTest = new ConfigSourceConfiguration();

			// Act
			itemUnderTest.Key = @"MyConfigSource";

			// Assert
			Assert.That(itemUnderTest.Key, Is.EqualTo(expectedValue));
		}

		[Test]
		public void CanSetMethodProperty()
		{
			// Arrange
			const DrillBitConfigMethod expectedValue = DrillBitConfigMethod.ConfigFile;
			var itemUnderTest = new ConfigSourceConfiguration();

			// Act
			itemUnderTest.Method = DrillBitConfigMethod.ConfigFile;

			// Assert
			Assert.That(itemUnderTest.Method, Is.EqualTo(expectedValue));
		}

		[Test]
		public void CanSetValueProperty()
		{
			// Arrange
			const string expectedValue = "MyConfigFile.config";
			var itemUnderTest = new ConfigSourceConfiguration();

			// Act
			itemUnderTest.Value = @"MyConfigFile.config";

			// Assert
			Assert.That(itemUnderTest.Value, Is.EqualTo(expectedValue));
		}
	}
}